------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\figure3.log
  log type:  text
 opened on:  30 Mar 2017, 13:55:56

. #delimit ;
delimiter now ;
. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:      africancabinets_figure3.do                      *;
. *       Date:           September 19, 2016                              *;
. *       Author:         Molly Ariotti and Sona Golder                   *;
. *       Purpose:        Produce Figure 3 for CPS African portfolio      *;
. *                       allocation paper.                               *;
. *           Input File:     Africa.dta, Europe.dta                          *;
. *       Output File:    figure3.log, coefplot.eps                       *;
. *       Data Output:    none                                            *;
.              *       Previous file:  none                                            *;
. *       Machine:        laptop                                                          *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. use "\Users\sgolder\Dropbox\Portfolio Allocation\replication\Africa.dta";

.  *     ****************************************************************  *;
. *       Drop African cabinets where there is no formateur coded.        *;
. *     ****************************************************************  *;
. drop if cabinetcode == 5;
(5 observations deleted)

. drop if cabinetcode == 23;
(3 observations deleted)

. *     ****************************************************************  *;
. *       Add Europe data from Warwick and Druckman (2006)                *;
. *     ****************************************************************  *;
. append using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\Europe.dta";
(note: variable year was int, now float to accommodate using data's values)
(note: variable party was long, now double to accommodate using data's values)
(note: variable party_seats was int, now float to accommodate using data's values)
(note: variable formateur was byte, now float to accommodate using data's values)
(note: variable government_portfolios was byte, now float to accommodate using data's values)
(note: variable countrycode was byte, now float to accommodate using data's values)
(note: variable portfolios was byte, now float to accommodate using data's values)
(note: variable cabinetcode was byte, now float to accommodate using data's values)
(note: variable region was byte, now float to accommodate using data's values)
(note: variable cowcode was int, now float to accommodate using data's values)
(note: variable government_seats was int, now float to accommodate using data's values)
(note: variable presidential was byte, now float to accommodate using data's values)

.  *     ****************************************************************  *;
. *       Drop European cabinets where there is no formateur coded.       *;
. *      (These are caseno 531, 532, 533, 534, 542,543, 617, 858, 859)    *;
. *     ****************************************************************  *;
. drop if code == 205097;
(3 observations deleted)

. drop if code == 205098;
(2 observations deleted)

. drop if code == 205099;
(2 observations deleted)

. drop if code == 205100;
(2 observations deleted)

. drop if code == 205108;
(4 observations deleted)

. drop if code == 205109;
(4 observations deleted)

. drop if code == 207130;
(3 observations deleted)

. drop if code == 209184;
(6 observations deleted)

. drop if code == 209185;
(4 observations deleted)

. *     ****************************************************************  *;
. *       Create regional, parliamentary dummy variables                  *;
. *     ****************************************************************  *;
. gen africa = . ;
(853 missing values generated)

. replace africa = 1 if region==1;
(76 real changes made)

. replace africa = 0 if region==2;
(777 real changes made)

. replace africa = 0 if region==3;
(0 real changes made)

. gen europe = . ;
(853 missing values generated)

. replace europe = 0 if region==1;
(76 real changes made)

. replace europe = 1 if region==2;
(777 real changes made)

. replace europe = 0 if region==3;
(0 real changes made)

. gen america = . ;
(853 missing values generated)

. replace america = 0 if region==1;
(76 real changes made)

. replace america = 0 if region==2;
(777 real changes made)

. replace america = 1 if region==3;
(0 real changes made)

. gen parliamentary = 0;

. replace parliamentary = 1 if presidential ==0;
(822 real changes made)

. *     ****************************************************************  *;
. *       Build the component parts for the coefficient plot.             *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Formateur in Europe                                             *;
. *     ****************************************************************  *;
. regress portfolioshare seatshare formateur if africa==0, robust;

Linear regression                               Number of obs     =        777
                                                F(2, 774)         =    3252.65
                                                Prob > F          =     0.0000
                                                R-squared         =     0.8970
                                                Root MSE          =      .0659

------------------------------------------------------------------------------
             |               Robust
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .8346488   .0137495    60.70   0.000      .807658    .8616395
   formateur |  -.0310149   .0073408    -4.23   0.000    -.0454251   -.0166047
       _cons |   .0654554   .0035579    18.40   0.000      .058471    .0724398
------------------------------------------------------------------------------

. lincom formateur;

 ( 1)  formateur = 0

------------------------------------------------------------------------------
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0310149   .0073408    -4.23   0.000    -.0454251   -.0166047
------------------------------------------------------------------------------

. matrix eur = J(1,2,.);

. matrix coln eur = estimate se;

. matrix rown eur = "Europe Parliamentary";

. matrix eur[1,1] = r(estimate);

. matrix eur[1,2] = r(se);

. *     ****************************************************************  *;
. *       Formateur in Africa (parliamentary)                             *;
. *     ****************************************************************  *;
. regress portfolioshare seatshare formateur if parliamentary == 1 & africa==1, robust;

Linear regression                               Number of obs     =         45
                                                F(2, 42)          =     758.45
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9711
                                                Root MSE          =     .04615

------------------------------------------------------------------------------
             |               Robust
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .9038053   .0388323    23.27   0.000     .8254386     .982172
   formateur |   .0572177   .0237512     2.41   0.020     .0092859    .1051495
       _cons |   .0129924   .0090057     1.44   0.157    -.0051819    .0311666
------------------------------------------------------------------------------

. lincom formateur;

 ( 1)  formateur = 0

------------------------------------------------------------------------------
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0572177   .0237512     2.41   0.020     .0092859    .1051495
------------------------------------------------------------------------------

. matrix afr = J(2,2,.);

. matrix coln afr = estimate se;

. matrix rown afr =  "Africa Parliamentary" "Africa Presidential";

. matrix afr[1,1] = r(estimate);

. matrix afr[1,2] = r(se);

. *     ****************************************************************  *;
. *       Formateur in Africa (presidential)                              *;
. *     ****************************************************************  *;
. regress portfolioshare seatshare formateur if parliamentary == 0 & africa==1, robust;

Linear regression                               Number of obs     =         31
                                                F(2, 28)          =     472.88
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9676
                                                Root MSE          =     .06103

------------------------------------------------------------------------------
             |               Robust
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .7736803    .075247    10.28   0.000     .6195438    .9278167
   formateur |   .2448744   .0499857     4.90   0.000     .1424833    .3472655
       _cons |  -.0065839    .014541    -0.45   0.654    -.0363697    .0232019
------------------------------------------------------------------------------

. lincom formateur;

 ( 1)  formateur = 0

------------------------------------------------------------------------------
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .2448744   .0499857     4.90   0.000     .1424833    .3472655
------------------------------------------------------------------------------

. matrix afr[2,1] = r(estimate);

. matrix afr[2,2] = r(se);

. *     ****************************************************************  *;
. *       Produce Figure 3                                                *;
. *     ****************************************************************  *;
. coefplot (matrix(eur[.,1]), se(eur[.,2]) offset(0) m(smcircle) mfcolor(eltblue*.4)mlc(eltblue) ciop(lcolor(eltbl
> ue)) label(Europe)) 
>         (matrix(afr[.,1]), offset(0) se(afr[.,2]) m(smcircle) mfcolor(red*.25) mlc(red*1.2)     ciop(lcolor(red)
> ) label(Africa)), 
>         xline(0, lcolor(gs10) lpattern(dash)) legend(off)  
>     scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white))
>         xtitle("Formateur Bonus", height(7) size(3) ) ytitle("")
>     xlabel(0 0.1 0.2 0.3 0.4, nogrid labsize(2.5))
>         levels(95) coeflabels(Europe Parliamentary = "Europe Parliamentary" Africa Presidential ="Africa Preside
> ntial"
>         Africa Parliamentary = "Africa Parliamentary" , labsize(3)  notick wrap(18)) grid(n) plotregion(style(no
> ne)) yscale(noline);

. graph export "\Users\sgolder\Dropbox\Portfolio Allocation\replication\coefplot.eps", replace;
(file \Users\sgolder\Dropbox\Portfolio Allocation\replication\coefplot.eps written in EPS format)

. log close;
      name:  <unnamed>
       log:  C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\figure3.log
  log type:  text
 closed on:  30 Mar 2017, 13:55:57
------------------------------------------------------------------------------------------------------------------
